<template>
	<view class="detail">
		<view class="btn-wrap">
			<view class="btn" @click="getList(index)" :class="{active:curindex==index}" v-for="(item,index) in btns" :key="index">{{item}}</view>
		</view>
		<view class="detail-list">
			<view class="per-list flex" v-for="(item,index) in list" :key="index">
				<view class="flex flex-column">
					<text class="content">{{item.remarks}}</text>
					<text class="time">{{item.createTime}}</text>
				</view>
				<view class="money" :class="{down:item.amount<0}">{{item.amount}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	import fetch from '@/common/fetch.js';
	export default{
		data(){
			return{
				list:[],
				curindex:0,
				btns:{}
			}
		},
		mounted(){
			this.getList(0)
		},
		methods:{
			getList(type){
				this.curindex = type
				let postdata = {
					type:type
				}
				fetch.request('/index/mobile/assets',postdata,'GET').then(res=>{
					let {data} = res
					this.btns = Object.assign({0:'All'},data.coin_type)
					this.list = data.data.data
				})
				
				}
		}
	}
</script>

<style lang="less" scoped>
	.flex{
		display: flex;
	}
	.flex-column{
		flex-direction: column;
	}
	page,.detail{
		width: 100%;
		min-height: 100%;
	}
	.detail{
		padding: 20rpx 30rpx;
		box-sizing: border-box;
	}
	.btn-wrap{
		display: flex;
		overflow-x: auto;
		 justify-content: space-between;
		.btn{
			padding:0 20rpx;
			height: 60rpx;
			text-align: center;
			line-height: 60rpx;
			border-radius:60rpx;
			flex-basis: 152rpx;
			flex-shrink: 0;
		   white-space: nowrap;
		}
		.active{
			background: #F53D46;
			color: #fff;
			font-size: 14px;
		}
	}
	.detail-list{
		.per-list{
			padding:  30rpx 0;
			box-sizing: border-box;
			border-bottom: solid 1rpx #f4f4f4;
			align-items: center;
			justify-content: space-between;
			.content{
				font-size: 14px;
			}
			.time{
				font-size: 12px;
				color: #aaa;
				margin-top: 20rpx;
			}
			.money{
				font-size: 16px;
				color:#ff0000;
			}
			.down{
				color: #ff7800;
			}
		}
	}
</style>
